#include "connection.h"

#include "packet.h"

namespace anb { namespace net {

connection::connection(loop::ptr loop, uv_tcp_t* tcp, dispatcher::ptr dispatcher) : connection_base(loop, tcp, packet::SIZE + LEN_SIZE), m_dispatcher(dispatcher) {
}

connection::~connection() {
}

void connection::handle_head(const uv_buf_t& segment) {
	packet packet;
	packet.deserialize_head(segment.base, segment.len);
	cmd_handler::ptr cmd_handler = m_dispatcher->get_cmd_handler(packet.cmd);
	if (!cmd_handler) {
		//
	}
}

void connection::handle_body(const uv_buf_t& segment) {
}

void connection::send_packet() {
}

} }
